#ifndef TileCacheOther_h__
#define TileCacheOther_h__
#include "../Detour/DetourNavMeshQuery.h"
#include "../Detour/DetourNavMeshBuilder.h"

#include "../DetourTileCache/Include/DetourTileCache.h"
#include "../DetourTileCache/Include/DetourTileCacheBuilder.h"
#include "../RecastDemo/InputGeom.h"
//#ifndef TileCacheOther_h__
//#define TileCacheOther_h__
//
//
//#include <Detour/DetourNavMeshQuery.h>
//#include <Detour/DetourNavMeshBuilder.h>
//#include <DetourTileCache/Include/DetourTileCache.h>
//#include <DetourTileCache/Include/DetourTileCacheBuilder.h>
//#include <RecastDemo/InputGeom.h>

#include <string.h>
#include <string>
#include <map>
#include <vector>
#include <fstream>


#pragma pack(push)
#pragma pack(1)
struct TileCacheSetHeader
{
	int magic;
	int version;
	int numTiles;
	dtNavMeshParams meshParams;
	dtTileCacheParams cacheParams;
};

struct TileCacheTileHeader
{
	dtCompressedTileRef tileRef;
	int dataSize;
};
#pragma pack(pop)

struct MeshProcess : public dtTileCacheMeshProcess
{
private:
	InputGeom* m_geom;
public:
	MeshProcess();
	inline void init(InputGeom* geom);
	virtual void process(struct dtNavMeshCreateParams* params, unsigned char* polyAreas, unsigned short* polyFlags);
};

struct FastLZCompressor : public dtTileCacheCompressor
{
	virtual int maxCompressedSize(const int bufferSize);

	virtual dtStatus compress(const unsigned char* buffer, const int bufferSize,
		unsigned char* compressed, const int /*maxCompressedSize*/, int* compressedSize);

	virtual dtStatus decompress(const unsigned char* compressed, const int compressedSize,
		unsigned char* buffer, const int maxBufferSize, int* bufferSize);
};
#endif